package com.springboot.java.design.chainofresponsibility;

import lombok.extern.slf4j.Slf4j;

/**
 * @Author: TongRui乀
 * @Date: 2019/3/6 14:16
 * @description：
 */
@Slf4j
public  abstract class Player {

    private Player successer;

    public abstract void handler(int index);

    public void setNext(Player player){
        this.successer = player;
    }

    public void next(int index){

        if(this.successer != null){
            this.successer.handler(index);
        }else{
            log.info("游戏结束！");
        }

    }
}
